package com.example.helloworld;

import java.util.Scanner;

public class ScannerDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter your name:");
        if (scanner.hasNextLine()) {
            String name = scanner.next();
            System.out.println("Hello, " + name + "!");
        }
        scanner.close();
    }
}
